package innerclass;

/**
 * 外部类
 */
public class OuterClass {
    private int a = 100;
    public OuterClass(int a){
        this.a = a;
    }
    /**
     * 成员内部类
     */
    public class InnerClass{
        private int a = 1000;
        public void intro(){
            System.out.println(this.a);
        }
    }

    /**
     * 静态内部类
     */
    public static class StaticInnerClass{
        private int a = 2000;
        public void intro(){
            System.out.println(this.a);
        }
    }

    public void intro(){
//        class LocalInnerClass{
//            private int a = 3000;
//            public void intro(){
//                System.out.println(this.a);
//            }
//        }
//        LocalInnerClass lic = new LocalInnerClass();
//        lic.intro();
        OuterClass oc = new OuterClass(200){
            private int a = 4000;
            public void intro(){
                System.out.println(this.a);
                show();
            }
            public void show(){
                System.out.println("show");
            }
        };
        oc.intro();
//        oc.show();

    }


    public static void main(String[] args) {
        OuterClass outerClass = new OuterClass(100);
//        OuterClass.InnerClass oi = outerClass.new InnerClass();
//        oi.intro();

//        OuterClass.StaticInnerClass os = new OuterClass.StaticInnerClass();
//        os.intro();

        outerClass.intro();
    }
}
